package com.aspose.cells;

import java.util.ArrayList;

class zapj {
   private zcfw b;
   private zapy c;
   private zapz d;
   private int e;
   private int f;
   private int g;
   private Worksheet h;
   private Cells i;
   private zapn j;
   zarb a;
   private RowCollection k;
   private zr l;
   private zp m;
   private Row n;
   private int o;
   private int p;
   private int q;
   private zbbj r;
   private zbbj s;
   private zfv t = new zfv();
   private zfv u;
   private zapj.za v;
   private static final com.aspose.cells.b.c.a.za w = new com.aspose.cells.b.c.a.za(new String[]{"table-column", "table-row", "table-header-rows", "table-header-columns", "table-column-group", "table-row-group", "style-name", "number-columns-repeated", "default-cell-style-name", "visibility", "visible", "collapse", "filter", "table-cell", "covered-table-cell", "number-rows-repeated", "number-matrix-columns-spanned", "number-matrix-rows-spanned", "value-type", "time-value", "value", "date-value", "boolean-value", "number-columns-spanned", "number-rows-spanned", "formula", "boolean", "date", "time", "currency", "percentage", "float", "string", "span", "rect", "ellipse", "custom-shape", "frame", "p", "annotation", "a", "href"});

   zapj(zapy var1) {
      this.c = var1;
      this.j = new zapn(var1);
      this.a = new zarb(var1);
   }

   void a(zcfw var1, zapz var2) throws Exception {
      this.b = var1;
      this.d = var2;
      this.h = var2.a;
      this.i = this.h.getCells();
      this.f = this.g = -1;
      this.e = 0;
      if (var1.n()) {
         var1.a();
      } else {
         this.i.a(1024, 1024, 64);
         this.l = this.h.getCells().f();
         this.k = this.i.getRows();
         this.o = -1;
         this.p = -1;
         this.q = -1;
         this.m = null;
         this.n = null;
         this.r = null;
         this.v = null;
         var1.d();

         while(zass.a(var1)) {
            switch(w.a(var1.p().toLowerCase())) {
            case 0:
               this.c();
               break;
            case 1:
               this.f();
               break;
            case 2:
               this.d();
               break;
            case 3:
               this.a();
               break;
            case 4:
               this.b();
               break;
            case 5:
               this.e();
               break;
            default:
               var1.a();
            }
         }

         this.a(Integer.MAX_VALUE);
         this.l.a(-10, 0, 0, 0);
         this.i.g();
         this.i.a((short)this.q);
      }
   }

   private void a() throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         this.b.d();

         while(zass.a(this.b)) {
            switch(w.a(this.b.p().toLowerCase())) {
            case 0:
               this.c();
               break;
            case 1:
            case 2:
            default:
               this.b.a();
               break;
            case 3:
               this.a();
               break;
            case 4:
               this.b();
            }
         }

      }
   }

   private void b() throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         ++this.e;
         this.b.d();

         while(zass.a(this.b)) {
            switch(w.a(this.b.p().toLowerCase())) {
            case 0:
               this.c();
               break;
            case 1:
            case 2:
            default:
               this.b.a();
               break;
            case 3:
               this.a();
               break;
            case 4:
               this.b();
            }
         }

         --this.e;
      }
   }

   private double a(double var1) {
      int var3 = (int)(var1 * this.c.a / 72.0D);
      WorksheetCollection var4 = this.c.b.getWorksheets();
      return zkp.a((double)var3, var4);
   }

   private void c() throws Exception {
      String var1 = null;
      int var2 = 1;
      String var3 = null;
      boolean var4 = true;
      boolean var5 = false;
      if (this.b.m()) {
         while(this.b.l()) {
            switch(w.a(this.b.p().toLowerCase())) {
            case 6:
               var1 = this.b.s().toLowerCase();
               break;
            case 7:
               var2 = com.aspose.cells.b.a.zo.a(this.b.s());
               break;
            case 8:
               var3 = this.b.s();
               break;
            case 9:
               switch(w.a(this.b.s())) {
               case 10:
                  var4 = true;
                  break;
               case 11:
                  var4 = false;
                  var5 = true;
                  break;
               case 12:
                  var4 = false;
                  var5 = false;
               }
            }
         }
      }

      this.b.a();
      double var6 = 64.8D;
      if (var1 != null) {
         zaps var8 = (zaps)this.c.f.get(var1);
         if (var8 != null) {
            var6 = var8.a();
         }
      }

      boolean var12 = true;
      if (this.e > (this.i.u() & 255)) {
         this.i.b((byte)this.e);
      }

      for(int var9 = 0; var9 < var2; ++var9) {
         zapr var10 = this.d.d(this.g + var9 + 1);
         int var13 = var10.h;
         if (!var4 || this.e != 0 || Math.abs(var6 - this.d.f) > 1.0E-4D || var13 != 15) {
            Column var11 = this.i.getColumns().get(this.g + var9 + 1);
            var11.setWidth(this.a(var6));
            var11.c(var13);
            var11.a((byte)this.e);
            var11.setHidden(!var4);
            var11.b(var5);
         }
      }

      this.g += var2;
   }

   private void d() throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         this.b.d();

         while(zass.a(this.b)) {
            switch(w.a(this.b.p().toLowerCase())) {
            case 1:
               this.f();
               break;
            case 2:
               this.d();
               break;
            case 3:
            case 4:
            default:
               this.b.a();
               break;
            case 5:
               this.e();
            }
         }

      }
   }

   private void e() throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         ++this.e;
         this.b.d();

         while(zass.a(this.b)) {
            switch(w.a(this.b.p().toLowerCase())) {
            case 1:
               this.f();
               break;
            case 2:
               this.d();
               break;
            case 3:
            case 4:
            default:
               this.b.a();
               break;
            case 5:
               this.e();
            }
         }

         --this.e;
      }
   }

   private void a(int var1) {
      if (this.v != null) {
         while(this.v.b != null) {
            this.v = this.v.b;
         }

         while(this.v.c.a.h() < var1) {
            this.v.c.a.f();
            this.v.c.a.l(0, 0);
            this.v = this.v.a;
            if (this.v == null) {
               break;
            }

            this.v.b = null;
         }

      }
   }

   private void f() throws Exception {
      byte var1 = 1;
      byte var2 = 15;
      ++this.f;
      this.a(this.f);
      if (this.r == null) {
         this.r = new zbbj();
         this.r.a(0, this.i);
         this.s = new zbbj();
      }

      this.r.a = this.f;
      this.s.a(this.r);
      int[] var3 = new int[]{var1};
      int[] var4 = new int[]{var2};
      this.a(var3, var4);
      int var5 = var3[0];
      int var6 = var4[0];
      if (this.b.n()) {
         this.b.a();
      } else {
         this.g = -1;
         this.p = -1;
         this.b.d();

         while(zass.a(this.b)) {
            switch(w.a(this.b.p().toLowerCase())) {
            case 13:
               this.a(var5, var6, false);
               break;
            case 14:
               this.a(var5, var6, true);
               break;
            default:
               this.b.a();
            }
         }
      }

      this.f += var5 - 1;
   }

   private void a(int[] var1, int[] var2) throws Exception {
      String var3 = null;
      var2[0] = 15;
      var1[0] = 1;
      boolean var4 = true;
      boolean var5 = false;
      if (this.b.m()) {
         while(true) {
            if (!this.b.l()) {
               this.b.k();
               break;
            }

            switch(w.a(this.b.p().toLowerCase())) {
            case 6:
               var3 = this.b.s();
               break;
            case 9:
               switch(w.a(this.b.s())) {
               case 10:
                  var4 = true;
                  continue;
               case 11:
                  var4 = false;
                  var5 = true;
                  continue;
               case 12:
                  var4 = false;
                  var5 = false;
               default:
                  continue;
               }
            case 15:
               var1[0] = com.aspose.cells.b.a.zo.a(this.b.s());
            }
         }
      }

      double var6 = 13.68D;
      boolean var8 = true;
      if (var3 != null && !"".equals(var3)) {
         zaqd var9 = (zaqd)this.c.d.get(var3);
         if (var9 != null) {
            var6 = var9.b();
            var8 = var9.c();
         }
      }

      zaqv var12 = this.d.e(this.f);
      if (var12 != null && var12.c != null) {
         Object var10 = this.c.c.get(var12.c);
         if (var10 != null) {
            var2[0] = (Integer)var10;
         }
      }

      if (this.e > (this.i.v() & 255)) {
         this.i.c((byte)this.e);
      }

      if (this.e != 0 || Math.abs(var6 * 20.0D - this.i.a()) > 1.0D || var2[0] != 15 || !var4) {
         this.s.d = var2[0];
         this.s.d(var2[0] != 15);
         this.s.e = (short)((int)(var6 * 20.0D + 0.5D));
         this.s.c(var8);
         this.s.b(!var4);
         this.s.a(var5);
         if (this.e != 0) {
            this.s.a((byte)this.e);
         }

         if (var1[0] > 1) {
            int var13 = this.f;

            for(int var11 = 0; var11 < var1[0]; ++var11) {
               this.s.a = this.f;
               this.r.a = this.f;
               if (!this.b(1)) {
                  this.m.b(this.s, 13);
               }

               ++this.f;
            }

            this.f = var13;
            this.s.a = var13;
            this.r.a = var13;
         } else if (!this.b(256)) {
            this.m.b(this.s, 13);
         }
      }

   }

   private boolean b(int var1) {
      if (this.m != null && this.m.h() == this.r.a) {
         this.m.f();
         return false;
      } else if (this.v == null) {
         this.v = this.c(var1);
         return true;
      } else if (this.v.c.a.h() == this.r.a) {
         this.n = this.v.c;
         this.m = this.n.a;
         this.m.f();
         return false;
      } else {
         zapj.za var2;
         if (this.v.c.a.h() < this.r.a) {
            do {
               if (this.v.a == null) {
                  this.v.a = this.c(var1);
                  this.v.a.b = this.v;
                  this.v = this.v.a;
                  return true;
               }

               this.v = this.v.a;
               if (this.v.c.a.h() == this.r.a) {
                  this.n = this.v.c;
                  this.m = this.n.a;
                  this.m.f();
                  return false;
               }
            } while(this.v.c.a.h() <= this.r.a);

            var2 = this.c(var1);
            var2.b = this.v.b;
            var2.a = this.v;
            this.v.b.a = var2;
            this.v.b = var2;
            this.v = var2;
            return true;
         } else {
            do {
               if (this.v.b == null) {
                  this.v.b = this.c(var1);
                  this.v.b.a = this.v;
                  this.v = this.v.b;
                  return true;
               }

               this.v = this.v.b;
               if (this.v.c.a.h() == this.r.a) {
                  this.n = this.v.c;
                  this.m = this.n.a;
                  this.m.f();
                  return false;
               }
            } while(this.v.c.a.h() >= this.r.a);

            var2 = this.c(var1);
            var2.b = this.v;
            var2.a = this.v.a;
            this.v.a.b = var2;
            this.v.a = var2;
            this.v = var2;
            return true;
         }
      }
   }

   private zapj.za c(int var1) {
      this.o = this.l.a(this.r.a, this.o);
      if (this.o < 0) {
         this.o = this.l.a(-this.o - 1, this.r.a == this.f ? this.s : this.r, var1);
      }

      this.m = this.l.f(this.o);
      this.n = new Row(this.i, this.k, this.m, false);
      zapj.za var2 = new zapj.za();
      var2.c = this.n;
      return var2;
   }

   private void a(int var1, int var2, boolean var3) throws Exception {
      int var4 = 1;
      String var5 = null;
      String var6 = null;
      String var7 = null;
      String var8 = null;
      int var9 = 1;
      int var10 = 1;
      int var11 = -1;
      int var12 = -1;
      ++this.g;
      if (this.b.m()) {
         while(true) {
            if (!this.b.l()) {
               this.b.k();
               break;
            }

            switch(w.a(this.b.p().toLowerCase())) {
            case 6:
               if (this.b.s() != null && !"".equals(this.b.s())) {
                  var5 = this.b.s();
               }
               break;
            case 7:
               var4 = com.aspose.cells.b.a.zo.a(this.b.s());
            case 8:
            case 9:
            case 10:
            case 11:
            case 12:
            case 13:
            case 14:
            case 15:
            default:
               break;
            case 16:
               var12 = com.aspose.cells.b.a.zo.a(this.b.s());
               break;
            case 17:
               var11 = com.aspose.cells.b.a.zo.a(this.b.s());
               break;
            case 18:
               var6 = this.b.s();
               break;
            case 19:
            case 20:
            case 21:
            case 22:
               var7 = this.b.s();
               break;
            case 23:
               var10 = com.aspose.cells.b.a.zo.a(this.b.s());
               break;
            case 24:
               var9 = com.aspose.cells.b.a.zo.a(this.b.s());
               break;
            case 25:
               var8 = this.b.s();
            }
         }
      }

      Cell var13 = null;
      int var14;
      int var17;
      int var18;
      if (var6 == null && var8 == null) {
         if (!var3) {
            var14 = var5 != null && this.c.c.get(var5) != null ? (Integer)this.c.c.get(var5) : 15;
            boolean var27 = false;
            boolean[] var28 = null;
            if (var4 <= 1) {
               if (var5 == null) {
                  if (var2 != 15) {
                     var27 = true;
                  }
               } else if (var2 != 15) {
                  if (var2 != var14) {
                     var27 = true;
                  }
               } else if (this.d.b(this.g) != var14) {
                  var27 = true;
               }
            } else if (var5 == null) {
               if (var2 != 15) {
                  var27 = true;
               }
            } else if (var2 != 15) {
               if (var2 != var14) {
                  var27 = true;
               }
            } else {
               for(var17 = 0; var17 < var4; ++var17) {
                  if (this.d.b(this.g + var17) != var14) {
                     if (var27) {
                        if (var28 != null) {
                           var28[var17] = true;
                        }
                     } else {
                        var27 = true;
                        if (var17 > 0) {
                           var28 = new boolean[var4];

                           for(var18 = 0; var18 < var17; ++var18) {
                              var28[var18] = false;
                           }

                           var28[var17] = true;
                        }
                     }
                  } else if (var27) {
                     if (var28 == null) {
                        var28 = new boolean[var4];

                        for(var18 = 0; var18 < var17; ++var18) {
                           var28[var18] = true;
                        }
                     }

                     var28[var17] = false;
                  }
               }
            }

            if (var27) {
               this.t.a(this.g);
               this.t.b = var14;
               if (var1 == 1) {
                  this.b(var4);
                  if (var4 == 1) {
                     this.p = this.m.a(this.g, this.p);
                     if (this.p < 0) {
                        this.t.a = (short)this.g;
                        this.p = this.m.a(-this.p - 1, this.t);
                     } else {
                        this.m.j(this.p, var14);
                     }

                     var13 = new Cell(this.n, this.p);
                  } else {
                     for(var17 = 0; var17 < var4; ++var17) {
                        if (var28 == null || var28[var17]) {
                           this.p = this.m.a(this.g + var17, this.p);
                           if (this.p < 0) {
                              this.t.a = (short)(this.g + var17);
                              this.p = this.m.a(-this.p - 1, this.t);
                           } else {
                              this.m.j(this.p, var14);
                           }

                           if (var17 == 0) {
                              var13 = new Cell(this.n, this.p);
                           }
                        }
                     }
                  }
               } else {
                  var17 = 0;

                  while(true) {
                     if (var17 >= var1) {
                        this.r.a = this.f;
                        if (var13 != null) {
                           var13.a();
                        }
                        break;
                     }

                     this.b(var4);
                     this.p = -1;

                     for(var18 = 0; var18 < var4; ++var18) {
                        if (var28 == null || var28[var18]) {
                           this.p = this.m.a(this.g + var18, this.p);
                           if (this.p < 0) {
                              this.t.a = (short)(this.g + var18);
                              this.p = this.m.a(-this.p - 1, this.t);
                           } else {
                              this.m.j(this.p, var14);
                           }

                           if (var18 == 0 && var17 == 0) {
                              var13 = new Cell(this.n, this.p);
                           }
                        }
                     }

                     ++this.r.a;
                     ++var17;
                  }
               }

               if (this.g + var4 - 1 > this.q) {
                  this.q = this.g + var4 - 1;
               }

               if (var13 != null) {
                  this.u = var13.c;
               }
            }
         }
      } else {
         var14 = 15;
         if (var5 == null) {
            var14 = this.d.c(this.g);
         } else {
            Object var15 = this.c.c.get(var5);
            if (var15 != null) {
               var14 = (Integer)var15;
            }
         }

         this.b(var4);
         this.p = this.m.a(this.g, this.p);
         if (this.p > -1) {
            this.u = this.m.a(this.p, this.t, 7);
         } else {
            this.t.a(this.g);
            this.u = this.t;
         }

         this.u.b = var14;
         if (this.g > this.q) {
            this.q = this.g;
         }

         try {
            if (var8 != null) {
               if (this.p < 0) {
                  zavz.a((long)this.i.b.c, this.u);
                  this.p = this.m.a(-this.p - 1, this.u);
               } else {
                  this.m.j(this.p, var14);
               }

               var13 = new Cell(this.n, this.p);
               if (var11 != -1 && var12 != -1) {
                  var13.a(a(var8, this.h.getName()), var11, var12);
               } else {
                  String var23 = a(var8, this.h.getName());
                  if (var23 != null && var23.length() > 1) {
                     var13.setFormula(var23);
                  }
               }

               this.u = var13.c;
            }
         } catch (Exception var22) {
            ;
         }

         switch(w.a(var6)) {
         case 26:
            zgy.a(this.u, 2, "true".equals(var7.toLowerCase()));
            break;
         case 27:
            try {
               var7 = var7.replace('T', ' ');
               DateTime var26 = DateTime.a(var7);
               double var16 = zbtq.a(var26, this.h.getWorkbook().getSettings().getDate1904());
               if (var16 < 0.0D) {
                  zgy.a(this.u, var7, this.i.e());
               } else {
                  zgy.a(this.u, 1, var16);
               }
            } catch (Exception var21) {
               ;
            }
            break;
         case 28:
            try {
               zgy.a(this.u, 1, zaqh.q(var7));
            } catch (Exception var20) {
               ;
            }
            break;
         case 29:
         case 30:
         case 31:
            try {
               zgy.a(this.u, 1, zaqh.k(var7));
            } catch (Exception var19) {
               ;
            }
            break;
         case 32:
            if (var7 != null) {
               byte var25 = zsk.a(var7);
               if (var25 != -1) {
                  zgy.a(this.u, 3, com.aspose.cells.a.c.zi.a(var25));
               } else {
                  zgy.a(this.u, var7, this.i.e());
               }
            }
         }

         if (var13 == null) {
            if (this.p < 0) {
               this.p = this.m.a(-this.p - 1, this.u);
            } else {
               this.m.b(this.p, this.u, 6);
            }

            var13 = new Cell(this.n, this.p);
         }
      }

      boolean var24 = false;
      if (var10 != 1 || var9 != 1) {
         var24 = true;
         this.i.merge(this.f, this.g, var9, var10);
         if (var13 != null) {
            var13.a();
            if (this.u.b != -1 && this.u.b != 15) {
               Style var32 = var13.p();
               if (var32.f()) {
                  zfv var29 = new zfv();
                  var29.b = this.u.b;

                  for(var17 = 0; var17 < var9; ++var17) {
                     this.b(var10);

                     for(var18 = 0; var18 < var10; ++var18) {
                        if (var17 != 0 || var18 != 0) {
                           var29.a = (short)(this.g + var18);
                           this.p = this.m.a(this.g + var18, this.p);
                           if (this.p < 0) {
                              this.p = this.m.a(-this.p - 1, var29);
                           } else {
                              this.m.j(this.p, var29.b);
                           }

                           if (var29.a > this.q) {
                              this.q = var29.a;
                           }
                        }
                     }

                     ++this.r.a;
                  }

                  this.r.a = this.f;
                  var13.a();
               }
            }
         }
      }

      if (this.b.n()) {
         this.b.a();
         this.g += var4 - 1;
      } else {
         ArrayList var33 = new ArrayList();
         this.b.d();

         while(true) {
            while(zass.a(this.b)) {
               switch(w.a(this.b.p().toLowerCase())) {
               case 33:
                  this.b.a(1);
                  this.a(var33, (Font)null, var13, var9, var10);
                  this.b.a(0);
                  if (this.b.r() == 3) {
                     this.b.a();
                  }
                  break;
               case 34:
                  this.a.a(this.d, "rect", this.f, this.g, this.b);
                  break;
               case 35:
                  this.a.a(this.d, "ellipse", this.f, this.g, this.b);
                  break;
               case 36:
                  this.a.a(this.d, "custom-shape", this.f, this.g, this.b);
                  break;
               case 37:
                  this.a.a(this.d, (String)null, this.f, this.g, this.b);
                  break;
               case 38:
                  if (var6 != null && !"string".equals(var6)) {
                     this.b.a();
                  } else {
                     this.b.a(1);
                     this.a(var13, var33, var1, var4);
                     this.b.a(0);
                     if (this.b.r() == 3) {
                        this.b.a();
                     }
                  }
                  break;
               case 39:
                  int var30 = this.h.getComments().add(this.f, this.g);
                  this.j.a((Shape)this.h.getComments().get(var30).getCommentShape(), (zcfw)this.b);
                  break;
               default:
                  this.b.a();
               }
            }

            if (var33.size() != 0) {
               if (var13 == null) {
                  this.b(var4);
                  this.p = this.m.a(this.g, this.p);
                  this.t.a(this.g);
                  if (this.p < 0) {
                     this.p = this.m.a(-this.p - 1, this.t);
                  }

                  var13 = new Cell(this.n, this.p);
                  this.u = var13.c;
               }

               this.a(var13, var33);
            } else if ("string".equals(var6) && var7 == null) {
               if (var13.f()) {
                  var13.a((Object)"", (byte)0);
               } else if (var13.d()) {
                  var13.putValue("");
               }
            }

            if (var13 != null && var4 > 1 && !var24) {
               Cell var31 = var13;

               for(var17 = 1; var17 < var4; ++var17) {
                  var13 = this.n.a(this.g + var17, false, false);
                  var13.copy(var31);
               }
            }

            this.g += var4 - 1;
            return;
         }
      }
   }

   static String a(String var0, String var1) {
      if (var0.startsWith("msoxl:")) {
         return var0.substring("msoxl:".length());
      } else {
         StringBuilder var2 = new StringBuilder();
         int var3 = 0;
         if (var0.startsWith("oooc:")) {
            var3 = 5;
         } else if (var0.startsWith("of:")) {
            var3 = 3;
         }

         if (var0.length() <= var3) {
            return null;
         } else {
            if (var0.charAt(var3) != '=') {
               var2.append('=');
            }

            label56:
            for(; var3 < var0.length(); ++var3) {
               char var4 = var0.charAt(var3);
               switch(var4) {
               case '"':
                  var2.append(var4);
                  ++var3;

                  while(true) {
                     if (var3 >= var0.length()) {
                        continue label56;
                     }

                     var4 = var0.charAt(var3);
                     var2.append(var4);
                     if (var4 == '"') {
                        continue label56;
                     }

                     ++var3;
                  }
               case ';':
                  var2.append(',');
                  break;
               case '[':
                  int var5 = a(']', var0, var3 + 1);
                  if (var5 == -1) {
                     var2.append(var4);
                  } else {
                     String var6 = var0.substring(var3 + 1, var3 + 1 + (var5 - (var3 + 1)));
                     if (var6.indexOf("#REF") != -1) {
                        var2.append("#REF!");
                     } else {
                        int var7 = a(':', var6, 0);
                        if (var7 == -1) {
                           a(var2, var6);
                        } else {
                           String var8 = var6.substring(0, 0 + var7);
                           String var9 = var6.substring(var7 + 1);
                           a(var2, var1, var8, var9);
                        }
                     }

                     var3 = var5;
                  }
                  break;
               default:
                  var2.append(var4);
               }
            }

            return com.aspose.cells.b.a.zr.a(var2);
         }
      }
   }

   private static String[] a(char var0, String var1) {
      int var2 = a(var0, var1, 0);
      if (var2 == -1) {
         return new String[]{var1};
      } else {
         return var2 == 0 ? new String[]{"", var1.substring(1)} : new String[]{var1.substring(0, 0 + var2), var1.substring(var2 + 1)};
      }
   }

   private static int a(char var0, String var1, int var2) {
      label39:
      for(; var2 < var1.length(); ++var2) {
         char var3 = var1.charAt(var2);
         switch(var3) {
         case '"':
            ++var2;

            while(true) {
               if (var2 >= var1.length()) {
                  continue label39;
               }

               var3 = var1.charAt(var2);
               if (var3 == '"') {
                  continue label39;
               }

               ++var2;
            }
         case '\'':
            ++var2;

            while(true) {
               if (var2 >= var1.length()) {
                  continue label39;
               }

               var3 = var1.charAt(var2);
               if (var3 == '\'') {
                  continue label39;
               }

               ++var2;
            }
         default:
            if (var3 == var0) {
               return var2;
            }
         }
      }

      return -1;
   }

   private static void a(StringBuilder var0, String var1, String var2, String var3) {
      String[] var4 = a('.', var2);
      String var5 = var4.length == 1 ? null : ("".equals(var4[0]) ? null : var4[0]);
      boolean var6 = false;
      if (var5 != null) {
         if (var5.charAt(0) == '$') {
            var5 = var5.substring(1);
         }

         if (var5.charAt(0) == '\'') {
            var5 = var5.substring(1, 1 + (var5.length() - 2));
         }

         var6 = zakq.b(var5);
      }

      String var7 = var4.length == 1 ? var2 : var4[1];
      var4 = com.aspose.cells.b.a.zv.d(var3, '.');
      String var8 = var4.length == 1 ? null : ("".equals(var4[0]) ? null : var4[0]);
      if (var8 != null) {
         if (var8.charAt(0) == '$') {
            var8 = var8.substring(1);
         }

         if (var8.charAt(0) == '\'') {
            var8 = var8.substring(1, 1 + (var8.length() - 2));
         }

         if (!var6) {
            var6 = zakq.b(var8);
         }
      }

      String var9 = var4.length == 1 ? var3 : var4[1];
      if (var5 != null || var8 != null) {
         if (var6) {
            var0.append('\'');
         }

         if (var5 == null) {
            if (com.aspose.cells.b.a.zv.b(var8, var1)) {
               var0.append(var8);
            } else {
               var0.append(var1);
               var0.append(':');
               var0.append(var8);
            }
         } else if (var8 != null && !com.aspose.cells.b.a.zv.b(var5, var8)) {
            var0.append(var5);
            var0.append(':');
            var0.append(var8);
         } else {
            var0.append(var5);
         }

         if (var6) {
            var0.append('\'');
         }

         var0.append('!');
      }

      var0.append(var7);
      var0.append(':');
      var0.append(var9);
   }

   private static void a(StringBuilder var0, String var1) {
      if (var1.indexOf("#REF") != -1) {
         var0.append("#REF!");
      } else {
         int var2 = a('.', var1, 0);
         if (var2 == -1) {
            var0.append(var1);
         } else if (var2 == 0) {
            var0.append(var1.substring(1));
         } else {
            String[] var3 = new String[]{var1.substring(0, 0 + var2), var1.substring(var2 + 1)};
            if (var3[0].charAt(0) == '$') {
               var3[0] = var3[0].substring(1);
            }

            if (var3[0].charAt(0) != '\'') {
               if (zakq.b(var3[0])) {
                  var0.append('\'');
                  var0.append(var3[0]);
                  var0.append('\'');
               } else {
                  var0.append(var3[0]);
               }
            } else if (var3[0].charAt(var3[0].length() - 1) != '\'') {
               var2 = var3[0].lastIndexOf(39);
               if (var2 != -1) {
                  var0.append('\'');
                  var0.append('[');
                  var0.append(var3[0].substring(1, 1 + (var2 - 1)));
                  var0.append(']');
                  if (var3[0].charAt(var2 + 1) == '$') {
                     var0.append(var3[0].substring(var2 + 2));
                  } else {
                     var0.append(var3[0].substring(var2 + 3));
                  }

                  var0.append('\'');
               } else {
                  var0.append(var3[0]);
               }
            } else {
               var0.append(var3[0]);
            }

            var0.append('!');
            var0.append(var3[1]);
         }

      }
   }

   private void a(Cell var1, ArrayList var2) {
      if (var2.size() == 1) {
         if (var1.f()) {
            ((zyi)var1.c.d).a((Cell)var1, (Object)((zaqu)var2.get(0)).a);
         } else {
            var1.putValue(((zaqu)var2.get(0)).a);
         }

      } else {
         StringBuilder var3 = new StringBuilder();
         ArrayList var4 = new ArrayList();

         for(int var5 = 0; var5 < var2.size(); ++var5) {
            zaqu var6 = (zaqu)var2.get(var5);
            FontSetting var7 = new FontSetting(var3.length(), var6.a.length(), this.c.b.getWorksheets(), false);
            com.aspose.cells.b.a.a.ze.a(var4, (Object)var7);
            var3.append(var6.a);
            if (var6.b == null) {
               var7.getFont().c(var1.p().getFont());
            } else {
               var7.getFont().c(var6.b);
            }
         }

         var1.a(com.aspose.cells.b.a.zr.a(var3), var4);
      }
   }

   void a(Cell var1, ArrayList var2, int var3, int var4) throws Exception {
      if (this.b.n()) {
         this.b.a();
      } else {
         zaqu var5;
         if (var2.size() != 0) {
            var5 = (zaqu)var2.get(var2.size() - 1);
            var5.a = var5.a + "\n";
            var2.set(var2.size() - 1, var5);
         }

         this.b.d();

         while(this.b.r() != 4) {
            this.b.j();
            if (this.b.r() != 1) {
               if (this.b.r() == 3) {
                  var5 = new zaqu();
                  var5.a = this.b.s();
                  com.aspose.cells.b.a.a.ze.a(var2, (Object)var5);
               }

               this.b.a();
            } else {
               switch(w.a(this.b.p().toLowerCase())) {
               case 33:
                  this.a(var2, (Font)null, var1, var3, var4);
                  break;
               case 40:
                  this.a(var1, (Font)null, var3, var4);
                  break;
               default:
                  this.b.a();
               }
            }
         }

         this.b.h();
      }
   }

   void a(ArrayList var1, Font var2, Cell var3, int var4, int var5) throws Exception {
      zaqu var6 = new zaqu();
      if (this.b.m()) {
         while(true) {
            if (!this.b.l()) {
               this.b.k();
               break;
            }

            switch(w.a(this.b.p())) {
            case 6:
               var6.b = (Font)this.c.g.get(this.b.s());
            }
         }
      }

      if (this.b.n()) {
         this.b.a();
      } else {
         this.b.d();

         while(this.b.r() != 4) {
            this.b.j();
            if (this.b.r() != 1) {
               if (this.b.r() == 3) {
                  var6.a = this.b.s();
                  com.aspose.cells.b.a.a.ze.a(var1, (Object)var6);
               }

               this.b.a();
            } else {
               switch(w.a(this.b.p().toLowerCase())) {
               case 33:
                  this.a(var1, var6.b, var3, var4, var5);
                  break;
               case 40:
                  this.a(var3, var6.b, var4, var5);
                  break;
               default:
                  this.b.a();
               }
            }
         }

         this.b.h();
      }
   }

   void a(Cell var1, Font var2, int var3, int var4) throws Exception {
      String var5 = null;
      if (this.b.m()) {
         while(true) {
            if (!this.b.l()) {
               this.b.k();
               break;
            }

            switch(w.a(this.b.p())) {
            case 41:
               var5 = this.b.s();
            }
         }
      }

      String var6 = this.b.i();
      if (var5 != null && !"".equals(var5)) {
         HyperlinkCollection var7 = this.d.a.getHyperlinks();
         if (var5.charAt(0) == '#') {
            var5 = var5.substring(1);
            if (var5.indexOf(46) != -1) {
               var5 = var5.replace('.', '!');
            } else if (this.c.b.getWorksheets().get(var5) != null) {
               var5 = var5 + "!" + this.c.b.getWorksheets().get(var5).getActiveCell();
            }
         }

         int var8 = var7.a(this.f, this.g, var3, var4, var5);
         var7.get(var8).setTextToDisplay(var6);
      }

      var1.putValue(var6);
      if (var2 != null) {
         Style var9 = var1.o();
         var9.getFont().c(var2);
         var1.a(var9);
      }

   }

   private class za {
      zapj.za a;
      zapj.za b;
      Row c;

      private za() {
      }

      // $FF: synthetic method
      za(Object var2) {
         this();
      }
   }
}
